home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / debugger / bdm-linu.0 / bdm-linu / bdm-linux / linux-io.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-27  |  644 b   |  52 lines

  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <fcntl.h>
  4.  
  5. int io_fdesc;
  6.  
  7. linux_io_init()
  8. {
  9.     io_fdesc = open ("/dev/port",O_RDWR);
  10.  
  11.     if (io_fdesc < 3) {
  12.         puts ("testport:  error on open");
  13.         exit (1);
  14.     }
  15.  
  16.     if (lseek (io_fdesc, 0x378, SEEK_SET) < 0) {
  17.         puts ("testport:  error on lseek");
  18.         exit (2);
  19.     }
  20. }
  21.  
  22. outportb(int p,unsigned char b)
  23. {
  24.     lseek (io_fdesc, p, SEEK_SET);
  25.     write (io_fdesc, &b , 1);
  26. }
  27. int inportb(int p)
  28. {
  29.     char b;
  30.     lseek (io_fdesc, p, SEEK_SET);
  31.     read (io_fdesc, &b, 1);
  32.  
  33.     return (int)b;
  34. }
  35.  
  36. disable()
  37. {
  38. }
  39. enable()
  40. {
  41. }
  42. static void bdm_dummy_call(int i)
  43. {
  44. }
  45.  
  46. bdm_delay(int i)
  47. {
  48.     int j;
  49.  
  50.     for (j=0;j<i;j++) bdm_dummy_call(j);
  51. }
  52.